<?php

class Sistema_Form_Sistema extends Zend_Form
{

    public function init()
    {
        $front = Zend_Controller_Front::getInstance();
        $controller = $front->getRequest()->getControllerName();
        $module = $front->getRequest()->getModuleName();
        $url = $front->getBaseUrl().'/'.$module.'/'.$controller;
        
        $this->setName('form_'.$controller);
        
        $el = new Zend_Form_Element_Hidden('SIS_ID',array('disableLoadDefaultDecorators' =>true));
        $el->addDecorators(array(array('ViewHelper'),array('Errors')))->addFilter('Int');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Text('SIS_VERCOD');
        $el->setLabel('Versão de Código')->setRequired(true)
        ->addFilters(array('StripTags','StringTrim'))
        ->addValidator('NotEmpty');
        $el->setAttrib('required','');
        $el->setAttrib('class','numero nummin');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Text('SIS_VERBD');
        $el->setLabel('Versão Banco de Dados')->setRequired(true)
        ->addFilters(array('StripTags','StringTrim'))
        ->addValidator('NotEmpty');
        $el->setAttrib('required','');
        $el->setAttrib('class','numero nummin');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Checkbox('SIS_EMLERRSTA',array());
        $el->setLabel('Envio de erro por e-mail');
        $this->addElement($el);
        
        $el = new Zend_Form_Element_Text('SIS_EMLERR');
        $el->setLabel('E-mail para envio de erro');
        $el->setAttrib('class', 'form-control');
        $this->addElement($el);
        
        $btn = new Zend_Form_Element_Submit('submit',array('disableLoadDefaultDecorators' =>true));
        $btn->addDecorators(array(array('ViewHelper'),array('Errors')));
        $btn->setLabel('Gravar');
        $btn->setAttrib('id', 'submitbutton');
        $btn->setAttrib('class', 'btn-frm');
        $this->addElement($btn);
        
        $btn = new Zend_Form_Element_Button('Cancelar',array('disableLoadDefaultDecorators' =>true));
        $btn->setDecorators(array(array('Description', array('escape' => false, 'tag' => false))));
        $btn->setDescription('<a href="'.$url.'" class="btn-frm">Cancelar</a>');
        $btn->setAttrib('id', 'btncancel');
        $btn->setAttrib('class', 'btn-frm');
        $this->addElement($btn);
    }


}

